﻿namespace WayneGameSolution.Communicate
{
    using System;
    using System.Collections.Generic;
    using System.Runtime.InteropServices;
    using WayneGameSolution.Strategies;

    public abstract class Crypt : ICrypt
    {
        private static IDictionary<string, Crypt> _Crypt;
        public static Crypt EmptyCrypt = new WayneGameSolution.Communicate.EmptyCrypt();
        protected Crypt(IDictionary<string, object> properties)
        {
            Properties = properties;
        }
 
        public static Crypt GetCrypt(string name_space)
        {
            return (Crypt)Unity.DefaultContainer.Resolve<ICrypt>(name_space); ;
        }

        public  IDictionary<string, object> Properties
        {
            get;
            protected set;
        }

      //  public abstract IDictionary<string, object> WayneGameSolution.Communicate.ICrypt.Properties { get; }

        #region ICrypt Members

        abstract public byte[] DeCrypt(byte[] packData);


        abstract public byte[] EnCrypt(byte[] packData);

        #endregion
    }


    public class EmptyCrypt : Crypt
    {

        public EmptyCrypt():base(new System.Collections.Generic.Sync.SyncDictionary <string,object>())
        { }
 

        public override byte[] DeCrypt(byte[] packData)
        {
            return packData;
        }

        public override byte[] EnCrypt(byte[] packData)
        {
            return packData;
        }
    }

}

